package d0906;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

public class Time类 {

    public static void main(String[] args) {

        Timer timer = new Timer();

        TimerTask tt = new TimerTask() {
            @Override
            public void run() {
                System.out.println("2秒之后, 休息一会");
                System.out.println(new Date());
            }
        };
        System.out.println(new Date());
        timer.schedule(tt, 2000);

        // 匿名类对象直接写在方法参数中  SWT, Swing
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.print(".");
            }

        }, 0, 100);

    }

}
